package com.syc.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.DeploymentBuilder;

public class ProcessDeploy {

    public static void main( String[] args ) {
        //创建流程引擎
        ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
        //得到流程存储服务对象
        RepositoryService repositoryService = engine.getRepositoryService();
        //创建DeploymentBuilder实例
        DeploymentBuilder builder = repositoryService.createDeployment();
        builder.addClasspathResource("bpmn/processDeploy.bpmn").deploy();
        //此处error.bpmn不是流程描述文件，这里将会抛出 ：
        //couldn't parse 'bpmn/error.bpmn': Premature end of file.
        builder = repositoryService.createDeployment();
        builder.addClasspathResource("bpmn/error.bpmn").deploy();
    }

}
